/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package web.services;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import se392.ateam2006.user.UserEntity;
import web.util.BusinessFacadeDelegate;

/**
 *
 * @author Caroline
 */
public class LoginService extends GenericService {


    public String executePreDispatch(HttpServletRequest request, ServletContext context) throws Exception {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void executePostDispatch(HttpServletRequest request, ServletContext context) throws Exception {
        BusinessFacadeDelegate delegate = this.getDelegate(request.getSession());
        String userName = request.getUserPrincipal().getName();
        UserEntity user = delegate.getUser(userName);
        delegate.setLoggedInUser(user);
    }

}
